<?php

$hero_week = $_cache_obj->get ( "hero_week_cache" );
$hero_month = $_cache_obj->get ( "hero_month_cache" );
$hero_all = $_cache_obj->get ( "hero_all_cache" );
 
if (! $hero_week) {
	$hero_week = db_factory::query ( "SELECT uid,username,sum(fina_cash) as cash,count(*) as count,(select reg_time from " . TABLEPRE . "witkey_space where uid =" . TABLEPRE . "witkey_finance.uid) as reg_time FROM " . TABLEPRE . "witkey_finance where fina_type='in'   and WEEKOFYEAR(from_unixtime(fina_time))=WEEKOFYEAR(NOW()) group by uid order by cash desc limit 0,5" );
}
 
if (! $hero_month) {
	$hero_month = db_factory::query ( "SELECT uid,username,sum(fina_cash) as cash,count(*) as count,(select reg_time from " . TABLEPRE . "witkey_space where uid =" . TABLEPRE . "witkey_finance.uid) as reg_time   FROM " . TABLEPRE . "witkey_finance where fina_type='in'  and MONTH(from_unixtime(fina_time))=MONTH(NOW()) and year(from_unixtime(fina_time))=year(now()) group by uid order by cash desc limit 0,5" );
}
 
if (! $hero_all) {
	$hero_all = db_factory::query ( "select a.uid,a.username,sum(a.fina_cash) \n".
"as cash,count(*) as count,b.reg_time\n".
"   FROM ".TABLEPRE."witkey_finance  as a \n".
"left join ".TABLEPRE."witkey_space as b on a.uid = b.uid \n".
"where fina_type='in'  group by uid order by cash desc limit 0,5" );
}


?> 